import { reqDelete, reqType, reqTypeAddOrUpdate } from "@/api/pinpai";

const state = {
  total: 0,
  typeArr: [],
};
const mutations = {
  GETLIST(state, payload) {
    state.total = payload.total;
    state.typeArr = payload.records;
  },
};
const actions = {
  async getTypeList({ commit }, [page, limit]) {
    const result = await reqType(page, limit);
    // console.log(result);
    commit("GETLIST", result.data);
  },

  async getTypeSave({ commit }, form) {
    const result = await reqTypeAddOrUpdate(form);

    // console.log(result);
  },
  async deleteType({ commit }, id) {
    await reqDelete(id);
  },
};
const getters = {};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
